<template>
  <div class="message">
    <header>
      <div class="shang"></div>
      <div class="xia">
        <i class="icon iconfont icon-arrow-left"></i>
        <p>消息列表</p>
        <span>
          <i class="iconfont icon-gengduo"></i>
          <i class="iconfont icon-play1"></i>
        </span>
      </div>
    </header>
    <main>
      <van-tabs>
        <van-tab title="消息">
          <van-swipe-cell v-for="v in list " :key="v.id">
            <van-cell :border="false" class="cell">
              <dl>
             <dt>
               <img :src="v.img" alt="" class="img1">
             </dt>
             <dd>
               <p>
                 <span>{{v.name}}</span>
                 <span>{{v.time}}</span>
               </p>
              <p>
                {{v.context}}
              </p>
             </dd>
           </dl>
            </van-cell>
            
            <template #right>
              <van-button square type="danger" text="删除" />
              <van-button square type="primary" text="置顶" />
            </template>
          </van-swipe-cell>
        </van-tab>
        <van-tab title="公告" id="second">
          <ul v-for="v in obj" :key="v.id">
            <li>
              <span>  {{v.title}}</span>
              <span>{{v.time}}</span>
            </li>
            <li>
              <p>{{v.context}}</p>
            </li>
          </ul>
         
        </van-tab>
      </van-tabs>
    

    
    </main>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      list: [],
      active: 2,
      obj:[],
    };
  },
  created() {
    axios.get("/searchInfore").then((res) => {
      // console.log(res);
      if (res.data.code === 1) {
        this.list = res.data.data;
      }
    });
    axios.get("/announcement").then(res=>{
      console.log(res,'111');
      if(res.data.code===1){
        this.obj=res.data.data;
      }
    })
  },
};
</script>

<style lang="scss" scoped>
#second{

  ul{
    display: block;
    width: 88%;
    border:1px solid #000;
   padding: 15px 8px;
   margin: 10px auto;
   li{
     display: flex;
     justify-content: space-between;
     span{
       font-size: 14px;
     }
   }
   li p{
     margin-top: 10px;
     font-size: 16px;
     font-size: 12px;
   }

  }
}
.message {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  header {
    height: 110px;
    background: #2492f9;
    .shang {
      height: 50px;
    }
    .xia {
      padding: 0 13px;
      height: 60px;
      align-items: center;
      display: flex;
      justify-content: space-between;
      color: #fff;
      font-size: 18px;
      > i {
        font-size: 20px;
        font-weight: bold;
      }
      > span {
        padding: 6px 16px;
        border-radius: 16px;
        border: 2px solid #fff;
        display: flex;
        i {
          font-size: 16px;
        }
        .icon-play1 {
          margin-left: 20px;
        }
      }
    }
  }
  main {
    flex: 1;
    overflow-y: scroll;
   
    > p {
      margin: 15px 0;
      line-height: 40px;
      font-size: 18px;
      display: flex;
      justify-content: space-around;
      span.active {
        color: cornflowerblue;
      }
    }
  }
}

.goods-card {
  margin: 0;
  background-color: #fff;
}

.delete-button {
  height: 100%;
}
.van-tab{
.dl{
  width: 90%;
  margin: 10px auto;
  border:2px solid #ccc;
}
}

.van-cell{
  dl{
    display: flex;
  
   dd{
     margin-left: 5%;
     flex:1;
     p{
       display: flex;
       
       justify-content: space-between;
     }
   }
  }
}
.img1{
  width: 50px;
  height: 50px;
  border-radius: 50%;
}


</style>